﻿using B.S.Filtration.ErrorCode;
using B.S.Filtration.Write.Api.Application.Command.ProcessCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Filtration.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProcessController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProcessController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 工序列表添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddProcess(AddProcessCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序列表删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> DelProcess(DelProcessCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 工序列表修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<int>> UpdateProcess(UpdateProcessCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 工序分类新增
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddProcessType(AddProcessTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 删除工序分类
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> DelProcessType(DelProcessTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改工序分类
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdateProcessType(UpdateProcessTypeCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 新增工序(新)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddProcedure(AddProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 删除工序(新)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> DelProcedure(DelProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改工序(新)
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdateProcedure(UpdateProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 新增工艺
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddCraftsmanship(AddCraftsmanshipCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 新增工艺
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> DelCraftsmanship(DelCraftsmanshipCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改工艺
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> UpdateCraftsmanship(UpdateCraftsmanshipCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 新增工艺工序关系表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddCraftProcedure(AddCraftProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 删除工艺工序关系表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> DelCraftProcedure(DelCraftProcedureCommand request)
        {
            return await mediator.Send(request);
        }

        /// <summary>
        /// 修改工艺工序关系表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> Handle(UpdateCraftProcedureCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
